import java.util.Arrays;

public class Map 
{
	private int location; //location = position in trail, measured in miles
	private int toNextLandmark;
	public static final int[] Landmark_Locations = {0, 102, 83, 119, 250, 86, 190, 102, 125, 162, 57, 182, 114, 162, 55, 120};
	public static final Landmark[] Landmarks = {new Landmark("Independence", true, 0, 0, false), new Landmark("Kansas River", false, 6, 10, true), new Landmark("Big Blue", false, 2, 4, false), new Landmark("Ft Kearny", true, 0, 0, false), new Landmark("Chimney Rock", false, 0, 0, false), new Landmark("Fort Laramie", true, 0, 0, false), new Landmark("Independence Rock", false, 0, 0, false), new Landmark("South Pass", false, 0, 0, false), new Landmark("Fort Bridger", true, 0, 0, false), new Landmark("Soda Springs", false, 0, 0, false), new Landmark("Fort Hall", true, 0, 0, false), new Landmark("Snake River Crossing", false, 4, 8, false), new Landmark("Fort Boise", true, 0, 0, false), new Landmark("Blue Mountains", false, 0, 0, false), new Landmark("Fort Walla Walla", true, 0, 0, false), new Landmark("Dalles", false, 0, 0, false)}; //initialize landmarks; indices should correspond to indices in Landmark_Locations
	private int nextLandmarkIndex;
	public static final int END_LOCATION = 1910;
	
	/**
	 * Constructor for the map class. Initializes instance variables to defaults. All you should ever need.
	 */
	public Map()
	{
		location = 0;
		nextLandmarkIndex = 1;
		
	}
	
	/**
	 * Allows movement of the wagon down the trail. Stops at landmarks.
	 * @param n Number of miles to move.
	 */
	public void move(int n)
	{
		location += n;
		toNextLandmark += n;
		
//		if(toNextLandmark > Landmark_Locations[nextLandmarkIndex])
//		{
//			location += (Landmark_Locations[nextLandmarkIndex] - toNextLandmark);
//			toNextLandmark = Landmark_Locations[++nextLandmarkIndex];	
//		}
//		else if(location == Landmark_Locations[nextLandmarkIndex])
//		{
//			toNextLandmark = 0;
//			nextLandmarkIndex++;
//		}
	}

	/**
	 * Accessor for the location field. Number of miles traveled down the trail so far.
	 * @return int value of the location field. 
	 */
	public int getLocation() 
	{
		return location;
	}
	
	/**
	 * Accessor for the toNextLandmark field. Number of miles until the next landmark.
	 * @return int value of Next landmark location - current location
	 */
	public int getToNextLandmark()
	{
		return Landmark_Locations[nextLandmarkIndex] - toNextLandmark;
	}

	/**
	 * Accessor for the nextLandmarkIndex field. Shouldn't need this method.
	 * @return int value of the next landmark index
	 */
	public int getNextLandmarkIndex() 
	{
		return nextLandmarkIndex;
	}
	
	public boolean thereYet(){
		if (location == END_LOCATION){
			return true;
		}
		else {
			return false;
		}
	}
}
